from flask import Blueprint, Flask

from com.utils import register_api_func

from .admin_api import ArticleAPI, CategoryAPI, UserAPI


def register_api(app: Flask):
    api_bp = Blueprint("api", __name__, url_prefix="/api/v1")
    register_api_func(api_bp, UserAPI, "/admin/user", "user_id")
    register_api_func(api_bp, ArticleAPI, "/admin/article", "article_id")
    register_api_func(api_bp, CategoryAPI, "/admin/category", "category_id")
    app.register_blueprint(api_bp)
